import { getToken, request } from '@inbiz/utils';
import req from 'umi-request';

const token = getToken();
// 获取流程
export async function getProcessInfo(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getProcessDetails`, {
    method: 'get',
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取搜索条件-流程
export async function getProcessList(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getCountByUserId`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取老表单
export async function getOldform(params) {
  return req(
    `edoc2Flow-web/edoc2-form/jumpIndex?skin=&orgToken=${token}&t=${Math.random()}&taskType=BeginTask&isMobile=true`,
    {
      params,
      headers: {
        vVersion: 'v6',
      },
    },
  );
}

// 获取流程
export async function getToMe(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyCctome`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取流程
export async function getMyApply(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyInitiatorv6`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取流程
export async function getHaveDone(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyComplete`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取流程
export async function getClassification(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyArchive`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取流程
export async function getMyApplying(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyInitiatorv6`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}

// 获取流程
export async function getMyToDo(params?: any) {
  return request(`/edoc2Flow-web/process/getResults/getMyInbox`, {
    params,
    headers: {
      vVersion: 'v6',
    },
  });
}
